#include<stdio.h>
#include<iostream>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
bool findarr(int x[],int n,int f)
{
    for(int i =0;i<n;++i)
    {
        if(x[i]==f)
            return true;
    }
    return false;
}
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int arr1[1000];
        int count = 0;
        for(int i=0;i<n;++i)
        {
            char arr[4];
            int x,sum=0;
            scanf("%d",&x);
            sprintf(arr,"%d",x);
            for(int j=0;j<strlen(arr);++j)
            {
                sum+=(arr[j]-'0');
            }
            if(!findarr(arr1,count,sum))
            {
                arr1[count]=sum;
                count++;
            }
        }
        sort(arr1,arr1+count);
        printf("%d\n",count);
        for(int k =0 ;k<count;++k)
        {
            printf("%d ",arr1[k]);
        }
    }
    return 0;
}